set(SRC_LIST "")
aux_source_directory(. SRC_LIST)
# 添加源文件到目标
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${SRC_LIST})
# 添加头文件到搜索路径
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

set( APP_SRC_LIST "")

# 定义文件夹列表
set(APP_DIRS
 dataPort
 dataProcess
 cmd
 ledControl
)

# 遍历文件夹列表并添加源文件
foreach(dir ${APP_DIRS})
    aux_source_directory(./${dir}  APP_SRC_LIST)
endforeach()

# 添加源文件到目标
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${APP_SRC_LIST})

# 遍历文件夹列表并添加头文件到搜索路径
foreach(dir ${APP_DIRS})
    target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
endforeach()